package com.middle.experiment01.mapper;

import com.middle.experiment01.entity.Course;
import com.middle.experiment01.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseMapper {

    @Select("select id, name, credit, description from course where id=#{id}")
    Course getById(String id);

    @Select("SELECT id, name, credit, description FROM course")
    List<Course> pageAllCourse();

    @Insert("insert into course  (id,name,credit,description)" +
            "values (#{id},#{name},#{credit},#{description})")
    void insert(Course c);

    @Delete("delete from course where id=#{id}")
    void deleteById(String id);

    void update(Course course);


    List<Student> getStudentById(String id);
}
